package TUILayer;

import DomainLayer.*;
/**
 *
 * @author tomas
 */
public class Printer
{
    public static void print(Person[] people)
    {
        System.out.format("%-4s%-4s%-18s%-18s%-12s%-12s%s\n", "#", "id", "Name",
                "Address", "Postal Code","City", "Phone Nr");
        for (int i = 0; i < people.length; i++)
        {
            Person pn = people[i];
            System.out.format("%-4d%-4d%-18s%-18s%-12d%-12s%d\n", i+1,
                    pn.getID(), pn.getName(), pn.getAddress(),
                    pn.getPostalCode(), pn.getCity(), pn.getPhone());
        }
    }

    public static void print(DVD[] dvds)
    {
        System.out.format("%-4s%-4s%-10s%-10s%s\n", "#", "id", "Title", 
                "Artist", "Publication Date");
        for (int i = 0; i < dvds.length; i++)
        {
            DVD dvd = dvds[i];
            System.out.format("%-4d%-4d%-10s%-10s%s\n", i+1, dvd.getId(),
                    dvd.getTitle(), dvd.getArtist(), dvd.getPublicationDate());
        }
    }

    public static void print(Copy[] copies)
    {
        System.out.format("%-4s%-4s%-12s%s\n", "#", "SN", "Rental Date",
                "Rental Price");
        for (int i = 0; i < copies.length; i++)
        {
            Copy cp = copies[i];
            System.out.format("%-4d%-4d%-12s%d\n", i + 1, cp.getSerialNumber(),
                    cp.getrented(), cp.getprice());
        }
    }

    public static void print(Loan[] loans)
    {
        System.out.format("%-4s%-4s%-12s%-10s%-10s%-15s%s\n", "#", "id", "Borrow Date",
                "State", "Period", "DVD Artist", "DVD title");

        for (int i = 0; i < loans.length; i++)
        {
            Loan ln = loans[i];
            System.out.format("%-4s%-4s%-12s%-10s%-10s%-15s%s\n", i+1,
                    ln.getId(), ln.getBorrowDate(), ln.getState(),
                    ln.getPeriod(), ln.getLoanCopy().getDVDName().getArtist(),
                    ln.getLoanCopy().getDVDName().getTitle());
        }
    }

    public void print(Person p)
    {
        System.out.format("%-4s%-4s%-18s%-18s%-12s%-12s%s\n", "id", "Name",
                "Address", "Postal Code","City", "Phone Nr");
        System.out.format("%-4d%-4d%-18s%-18s%-12d%-12s%d\n",
                p.getID(), p.getName(), p.getAddress(),
                p.getPostalCode(), p.getCity(), p.getPhone());
    }
}
